package com.mouliu.base.concurrent17;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/**
 * @author mouliu
 * @create 2018-04-12-下午9:41
 */
public class ScheduledJob {
    public static void main(String[] args){
        Temp command = new Temp();
        ScheduledExecutorService scheduledExecutorService
                = Executors.newScheduledThreadPool(3);

       ScheduledFuture<?>scheduledFuture=
                scheduledExecutorService.scheduleWithFixedDelay(command,5,1, TimeUnit.SECONDS);
/*      ScheduledFuture<?>scheduledFuture
              =scheduledExecutorService.schedule(command,5,TimeUnit.SECONDS);*/
    }
}
class Temp extends Thread{
    public void run(){
        System.out.println("run");
    }
}
